<!DOCTYPE html>
<html>
	<head>
		<title>Simple Markers</title>
		<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
		<style type="text/css">
			/* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
			#map {
				height: 100%;
			}

			/* Optional: Makes the sample page fill the window. */
			html,
			body {
				height: 100%;
				margin: 0;
				padding: 0;
			}
			.gmnoprint .gm-style-cc{
				display:none !important;
			}
			.gm-style-cc{
				display:none !important;
			}
		</style>
		<script>
			var lat1,lng1
			window.onload = function() {
			
				
			}

			function initMap() {
				console.log(location.search)
				var str = location.search;
				str = str.substring(1, str.length);
				// 以&分隔字符串，获得类似name=xiaoli这样的元素数组
				var arr = str.split("&");
				var obj = new Object();
				
				// 将每一个数组元素以=分隔并赋给obj对象
				for (var i = 0; i < arr.length; i++) {
					var tmp_arr = arr[i].split("=");
					obj[decodeURIComponent(tmp_arr[0])] = decodeURIComponent(tmp_arr[1]);
				}
				lat1 = Number(obj.lat)
				lng1 =  Number(obj.lng)
				const myLatLng = {
					lat: lat1,
					lng: lng1
				};
				console.log(myLatLng)
				const map = new google.maps.Map(document.getElementById("map"), {
					zoom: 15,
					center: myLatLng,
					disableDefaultUI: true,
					scaleControl: true,
				});
				new google.maps.Marker({
					position: myLatLng,
					map
				});
			}
		</script>
	</head>
	<body>
		<div id="map"></div>
<!--AIzaSyCdbjmG3M5keeuFLoeaVNRTf_zTS917648-->
		<!-- Async script executes immediately and must be after any DOM elements used in callback. -->
		<script
		
			src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC8jQSK_m7WU5QLV6zemkns14z_45TRmJw&callback=initMap&libraries=&v=weekly"
			async></script>
	</body>
</html>
